﻿//-----------------------------------------------------------------------
// <copyright file="CharacterClassTest.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings

using GateShift.Common.Repository.Interfaces.DataInterfaces;
using GateShift.Common.Repository.Interfaces.Repositories;
using GateShift.Services.GameFramework.GameObjects;
using GateShift.Testing.Mockup.DataLayer;
using Microsoft.VisualStudio.TestTools.UnitTesting;

#endregion

namespace GateShift.Testing.Services.GameFramework.GameObjects
{
    /// <summary>
    /// Summary description for CharacterClassTest
    /// </summary>
    [TestClass]
    public class CharacterClassTest
    {
        #region Test Variables
        private CharacterClass _characterClass;
        private ICharacterClassData _data;
        private MockRepositoryFactory _factory;
        #endregion

        #region Test Properties
        /// <summary>
        /// Gets or sets the test context which provides
        /// information about and functionality for the current test run.
        /// </summary>
        public TestContext TestContext { get; set; }
        #endregion

        #region Test Initialization/Cleanup

        [TestInitialize]
        public void TestInitialize()
        {
            _factory = new MockRepositoryFactory();
            _data = new MockCharacterClass();

            MockRepositoryFactory.TestInitialize();

            // Set up basic load mocks
            MockRepositoryFactory.GetMock<ICharacterClassRepository>().Expect(item => item.Create()).Returns(_data);

            _characterClass = new CharacterClass(_factory);
        }

        [TestCleanup]
        public void TestCleanup()
        {
            MockRepositoryFactory.TestCleanup();
            _characterClass = null;
        }

        #endregion

        #region Ranks

        [TestMethod]
        public void Ranks_Success()
        {
            _characterClass.Ranks = 123;
            Assert.AreEqual(123, _data.Ranks);
        }

        #endregion

        #region TotalAccuracy

        [TestMethod]
        public void TotalAccuracy_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierAccuracy = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalAccuracy);
        }

        #endregion

        #region TotalAccuracy

        [TestMethod]
        public void TotalAgility_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierAgility = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalAgility);
        }

        #endregion

        #region TotalEndurance

        [TestMethod]
        public void TotalEndurance_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierEndurance = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalEndurance);
        }

        #endregion

        #region TotalEnergy

        [TestMethod]
        public void TotalEnergy_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierEnergy = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalEnergy);
        }

        #endregion

        #region TotalForce

        [TestMethod]
        public void TotalForce_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierForce = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalForce);
        }

        #endregion

        #region TotalInsight

        [TestMethod]
        public void TotalInsight_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierInsight = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalInsight);
        }

        #endregion

        #region TotalIntellect

        [TestMethod]
        public void TotalIntellect_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierIntellect = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalIntellect);
        }

        #endregion

        #region TotalStrength

        [TestMethod]
        public void TotalStrength_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierStrength = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalStrength);
        }

        #endregion

        #region TotalWill

        [TestMethod]
        public void TotalWill_Success()
        {
            IClassData classData = new MockClass();
            MockRepositoryFactory.GetMock<IClassRepository>().Expect(item => item.Retrieve(classData.ID)).Returns(classData);
            classData.ModifierWill = 100;
            _data.Ranks = 2;
            _data.ClassID = classData.ID;

            Assert.AreEqual(200, _characterClass.TotalWill);
        }

        #endregion
    }
}